import pymysql

conn = pymysql.connect(host="localhost", port=3306, user="root", password="root", database="test", charset="utf8")
cursor = conn.cursor()

# sql = "select * from students where name = '%s'" % "黄药师"
sql = "select * from students where name = %s"
print(sql)
cursor.execute(sql, ("黄药师",))
# cursor.execute(sql, "黄药师")

for row in cursor.fetchall():
    print(row)

cursor.close()
conn.close()